// extract module
var http = require('http');
var fs = require('fs');
var jade = require('jade');

// create and run web server
http.createServer(function(request, response) {
	// read jade file
	fs.readFile('data.haml', 'utf8', function(error, data) {
		// use jade module
		var fn = jade.compile(data);
		
		// print
		response.writeHead(200, {'Content-Type': 'text/html'});
		response.end(fn({
			name: 'Sejoon',
			description: 'Hello Jade with Node.js!'
		}));
	});
}).listen(52273, function() {
	console.log('Server running at http://127.0.0.1:52273');
});